<script setup>
import { ref } from 'vue'
import {
  Fold,
  Expand
} from '@element-plus/icons-vue'
import MenuBar from './components/Menus/MenuBar.vue';

const isCollapse = ref(true)
</script>

<template>
  <div class="common-layout">
    <el-container>
      <el-aside :width="!isCollapse?'200px':'64px'">
        <!-- logo-box -->
        <div class="logo-box">
          <a href="/">
            <img src="./assets/logo.png" alt="logo.png" style="width:24px;">
            <h1 v-if="!isCollapse">KK-Vue</h1>
          </a>
        </div>
        <div class="menu-bar">
          <MenuBar :isCollapse="isCollapse" />
        </div>
      </el-aside>
      <el-container>
        <!-- Header -->
        <div class="header-box">
          <div class="collapse">
            <!-- 折叠 展开 -->
            <el-icon v-if="!isCollapse" @click="isCollapse = true">
              <Fold />
            </el-icon>
            <el-icon v-else @click="isCollapse = false">
              <Expand />
            </el-icon>
          </div>
        </div>
        <el-main class="main-box">
          <!-- Main -->
          <div class="main-content">
            <router-view />
          </div>
        </el-main>
        <el-footer>
          <div class="footer-box">
            <p>
              KK Company © Copyright By 2023-2025 All Rights Resvered.
            </p>
          </div>
        </el-footer>
      </el-container>
    </el-container>
  </div>
</template>

<style lang="less">
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
}

nav {
  padding: 30px;

  a {
    font-weight: bold;
    color: #2c3e50;

    &.router-link-exact-active {
      color: #42b983;
    }
  }
}
</style>